import plugin from '../../lib/plugins/plugin.js'
import { segment } from "oicq";
import fs from 'fs'


let path = "./resources/耀扬盒"
let yyhreg = new RegExp(`^(${fs.readdirSync(path).map(item => item.replace(".mp3", "")).join("|")})$`)

export class example extends plugin {
  constructor() {
    super({
      name: '耀扬盒',
      event: 'message',
      priority: 5000,
      rule: [
        {
          reg: '^耀扬盒$',
          fnc: 'help'
        },
        {
          reg: yyhreg,
          fnc: 'yyh'
        }
      ]

    })
  }


  async help(e) {
    let res = fs.readdirSync(path).map(item => item.replace(".mp3", "")).join("，")
    e.reply(res)
  }
  async yyh(e) {
    e.reply(segment.record(`${path}/${e.msg}.mp3`))
  }
}

